﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NX5Web.Controllers
{
    public class ApiBase
    {
        private String _Key = "";

        public static object locker = new object();

        public string Key
        {
            set { _Key = value; }
            get
            {
                if (String.IsNullOrEmpty(_Key))
                {
                    throw new Exception("No Auth Key");
                }

                if (!EncryptController.KeyList.ContainsKey(_Key))
                {
                    throw new Exception("Not Exists Key.");
                }
                lock (locker)
                {
                    EncryptController.KeyList.Remove(_Key);
                }
                return _Key;
            }
        }
    }
}